//- Copyright (c) 2016 Lucky Byte, Inc.
extends ../table

block form_items
  .field.thirteen.wide
    if page_perms.new
      button#new.ui.right.floated.green.button(type="button"
        onclick="window.location = '/hosts/new'") 新增主机
    else
      button#new.ui.right.floated.green.button.disabled(type="button")
        i.icon.ban
        | 新增主机

block thead
  tr
    th.center.aligned 序号
    th.center.aligned 主机名称
    th.center.aligned 公网地址
    th.center.aligned 内网地址
    th.center.aligned 是否默认
    th.center.aligned 备 注

block tbody
  each record, index in records
    - var tr_class = record.master ? 'positive' : ''
    tr(class="#{tr_class}")
      td.center.aligned.collapsing
        if page_perms.edit || page_perms.disable
          a(href="/hosts/edit/#{record.serial}")= record.serial
        else
          = record.serial
      td.center.aligned.collapsing= record.name
      td.center.aligned.collapsing= record.ipaddr
      td.center.aligned.collapsing= record.ipaddr_priv
      td.center.aligned.collapsing= record.master ? '是' : '否'
      td= record.notes
